﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace DAL
{
    public class HoaDon_DAO
    {
        clsDocSQL m_clsDocSQL = new clsDocSQL();
        public int ThemHoaDon(HoaDon_DTO dto)
        {
            SqlParameter[] m_SqlParameter = new SqlParameter[10];
            m_SqlParameter[0] = new SqlParameter("@MaHoaDon", dto.Str_MaHD);
            m_SqlParameter[1] = new SqlParameter("@NgayLap", dto.D_NgayLap);
            m_SqlParameter[2] = new SqlParameter("@MaNV", dto.Str_MaNV);
            m_SqlParameter[3] = new SqlParameter("@TenKH", dto.Str_TenKH);
            m_SqlParameter[4] = new SqlParameter("@DiaChi", dto.Str_DiaChi);
            m_SqlParameter[5] = new SqlParameter("@DienThoai", dto.Str_DienThoai);
            m_SqlParameter[6] = new SqlParameter("@Email", dto.Str_Email);
            m_SqlParameter[7] = new SqlParameter("@ThanhTien", dto.D_ThanhTien);
            m_SqlParameter[8] = new SqlParameter("@TrangThai", dto.I_TrangThai);
            m_SqlParameter[9] = new SqlParameter("@KQ", 0);
            m_SqlParameter[9].Direction = ParameterDirection.Output;
            int KQ = m_clsDocSQL.Insert_Delete_Update("sp_ThemHoaDon", m_SqlParameter);
            return KQ;
        }
        public string MaHoaDonTang()
        {
            return m_clsDocSQL.DocKieuString("MaHoaDon_Tang");
        }
    }
}
